package com.ivideo.avcore.filtercommon.utils;

import android.content.res.Resources;
import com.bawei.lib_common.base.BaseApplication;
import java.io.InputStream;

/**
 *@Author：lxy
 *@Description:
 *@Time：2025/7/2
*/
public class OpenGlUtils {
    //通过资源路径加载shader脚本文件
    public static String uRes(String path) {
        Resources resources = BaseApplication.instance.getResources();
        StringBuilder result = new StringBuilder();
        try {
            InputStream is = resources.getAssets().open(path);
            int ch;
            byte[] buffer = new byte[1024];
            while (-1 != (ch = is.read(buffer))) {
                result.append(new String(buffer, 0, ch));
            }
        } catch (Exception e) {
            return null;
        }
        return result.toString().replaceAll("\\r\\n", "\n");
    }
}
